package me.hunche.app.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.feinno.framework.common.domain.AbstractEntity;



@Entity
@Table(name="t_activity")
public class Activity extends AbstractEntity implements Serializable{
	
	private static final long serialVersionUID = -2981086447444181653L;
	
	@Id 
  @GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	private Date activityDate;
	private Integer least;
	private Integer amount;
	private String requires;
	private String line;
	private String rendezvous;
	private Date rendezvousTime;
	private Integer status;
	private Long teamId;
	private Date createDate;
	
	public final static int STATUS_NEW = 0;
	public final static int STATUS_RECRUIT = 1;
	public final static int STATUS_PREP = 2;
//	public final static int STATUS_RERECRUIT = 3;
	public final static int STATUS_READY2 = 4;
	public final static int STATUS_GOING = 5;
	public final static int STATUS_OVER = 10;
	public final static int STATUS_CANCELED = -1;
	
//	@ManyToOne
//	@JoinColumn(name = "team_id", referencedColumnName = "team_id")
	@Transient transient private Team team;
	
//	private User leader;
	@Transient transient private ActivityMember leader;
//	@OneToMany(cascade = CascadeType.REFRESH, mappedBy = "activity")
	@Transient transient private List<ActivityMember> members;

	@Transient transient private List<ActivityMember> allMembers;
	@Transient transient private List<ActivityMember> reserveMembers;
	
	public List<ActivityMember> getReserveMembers() {
		return reserveMembers;
	}
	public void setReserveMembers(List<ActivityMember> reserveMembers) {
		this.reserveMembers = reserveMembers;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}

	public String getLine() {
		return line;
	}
	public void setLine(String line) {
		this.line = line;
	}
	public String getRendezvous() {
		return rendezvous;
	}
	public void setRendezvous(String rendezvous) {
		this.rendezvous = rendezvous;
	}
	public Date getRendezvousTime() {
		return rendezvousTime;
	}
	public void setRendezvousTime(Date rendezvousTime) {
		this.rendezvousTime = rendezvousTime;
	}
	
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	public Integer getAmount() {
		return amount;
	}
	public void setAmount(Integer amount) {
		this.amount = amount;
	}

	public Team getTeam() {
		return team;
	}
	public void setTeam(Team team) {
		this.team = team;
	}
	
	public Long getTeamId() {
		return teamId;
	}
	public void setTeamId(Long teamId) {
		this.teamId = teamId;
	}
	
	public Integer getLeast() {
		return least;
	}
	public void setLeast(Integer least) {
		this.least = least;
	}

	public List<ActivityMember> getMembers() {
		return members;
	}
	public void setMembers(List<ActivityMember> members) {
		this.members = members;
	}
	
	public List<ActivityMember> getAllMembers() {
		return allMembers;
	}
	public void setAllMembers(List<ActivityMember> allMembers) {
		this.allMembers = allMembers;
	}
	
	@Override
	public String toString() {
		return "Activity [id=" + id + ", activityDate=" + activityDate + ", line=" + line
				+ ", rendezvous=" + rendezvous + ", rendezvousTime="
				+ rendezvousTime + ", status=" + status + ", teamId=" + teamId
				+ "]";
	}
	public ActivityMember getLeader() {
		return leader;
	}
	public void setLeader(ActivityMember leader) {
		this.leader = leader;
	}
	public Date getActivityDate() {
		return activityDate;
	}
	public void setActivityDate(Date activityDate) {
		this.activityDate = activityDate;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public String getRequires() {
		return requires;
	}
	public void setRequires(String requires) {
		this.requires = requires;
	}
	
//	@OneToMany(cascade = CascadeType.REFRESH, mappedBy = "activity")
//	public Set<ActivityMember> getBackupMembers() {
//		return backupMembers;
//	}
//	public void setBackupMembers(Set<ActivityMember> backupMembers) {
//		this.backupMembers = backupMembers;
//	}
//	


}
